cPy.cCore module

Contents

cPy.cCore module#

Expand for references to cPy.cCore

class BaseClass[source]#

Bases: object

Use this class for build a class for UI or serialization.
see class_reg.h for details about the class registration
GetClassMask() int[source]#
Masking elements of class. Each member has mask. Element is serializable/visible only if (it’s_mask & hosting_class_mask) != 0
ClassMask() int[source]#
runFunction(func: any)[source]#
reset_class(DataPtr: any = None)[source]#
CopyBaseClass(Dest: BaseClass, Add: bool = False) bool[source]#
Copy base class to other class uning names correspondence
Parameters:
  • Dest (BaseClass) – The destination object

  • Add (bool) – Add members to class arrays or replace

Returns:

true if successful

Return type:

bool

Save(xml: any, ClassPtr: any, Extra: any = None)[source]#
Save class to the XML structure
Parameters:
  • xml – The result

  • ClassPtr – The pointer to the data, equals to this if class is directly castable

  • Extra – Extra data pointer

Load(xml: any, ClassPtr: any, Extra: any = None) bool[source]#
Load the class from the XML structure
Parameters:
  • xml – The source XML

  • ClassPtr – The pointer to the data, equals to this if class is directly castable

  • Extra – Extra data pointer

Returns:

true if successful

Return type:

bool

FullCopy(SrcData: any, SrcDataExtra: any, Dest: BaseClass, DestData: any, DstDataExtra: any, C: any) bool[source]#
Fast copy from one BaseClass to another. Names and types correspondence used to copy.
Parameters:
  • SrcData – Data data pointer

  • SrcDataExtra – Src extra

  • Dest (BaseClass) – Destination class

  • DestData – Destination data

  • DstDataExtra – Destination extra

  • C – copy context

Returns:

true if successful

Return type:

bool

SaveBin(Data: any, Extra: any, Out: any, ExDictionary: any, SkipList: any)[source]#
Save in binaly form. Use only for temporary storage in memory!!!
Parameters:
  • Data – data pointer

  • Extra – extra pointer

  • Out – Output stream

  • ExDictionary – Dictionary for enumerators

  • SkipList – Skip list for enumerators

LoadBin(Data: any, Extra: any, In: any, ExDictionary: any)[source]#
Load the class from the memory. Use only for temporary storage in memory!!!
Parameters:
  • Data – Pointer to the class data

  • Extra – Extra data

  • In – binary stream to read data from

  • ExDictionary – Additional dictionary

GetAmountOfElementsInUI() int[source]#
return amount of elements represented in UI
GetAmountOfElementsInXML() int[source]#
return amount of elements taht will be stored in XML
pySerialize()[source]#
serialize and UI for python
pySerializeParentClass() bool[source]#
get_class_name() str[source]#
new_element() BaseClass[source]#
construct pointer to class of the same type like this. Elements will not be copied into the new place
GetElement(res: any, idx: int, Ptr: any = None, Extra: any = None) bool[source]#
The The function returns complete information about the member by it’s index. If you want to walk through all members use _EACH … _EACH_END loop.
Parameters:
  • res – All data gathered there

  • idx (int) – Index of the member

  • Ptr – Pointer to data (if class is direcly castable it is equal to this, othervice it points to placement of data in memory). If NULL passed, this will be used

  • Extra – Extra data, used for enumerators and sliders (mostly)

Returns:

return true if element exists and visible

Return type:

bool

GetElementByName(Name: str, Ptr: any, Extra: any, res: any, UI: bool = False, Serialize: bool = True) bool[source]#
The function returns complete information about the member by it’s name.
Parameters:
  • Name (str) – Name of the member

  • Ptr – Data ptr

  • Extra – Extra

  • res – All data gathered there

Returns:

return true if element exists and visible

Return type:

bool

GetElementByNameAndType(Name: str, Type: str, Ptr: any, Extra: any, res: any, UI: bool = False, Serialize: bool = True) bool[source]#
DeleteDefaultSubFields(xml: any, ClassPtr: any, Extra: any = None)[source]#
Short form saving. Fields that are unchanged in comparison to default will be skipped in XML.
ShouldSaveInShortForm() bool[source]#
Return true if class should be saved in short form mandatory
ExpandWith(ElmName: str, base: any) int[source]#
DelElement(Index: int) bool[source]#
auto_cast(ptr: any) BaseClass[source]#
ReadFromFile(Name: str, very_safe_with_backup: bool = False) bool[source]#
Save the object to file or binary stream.
Example
|         MyClass C;
|         MyClass C1;
// to stream
MemoryBinStream BS;
C.ToBS(BS, true);
// copy from C to C1
C1.FromBS(BS); *
// to file
C.WriteToFile(“file.xml”);
C1.ReadFromFile(“file.xml”); *
// to string
cStr s;
C.ToStr(s);
C1.FromStr(s);
WriteToFile(Name: str) bool[source]#
WriteToFileIfChanged(Name: str) bool[source]#
ToStr(bs: any)[source]#
FromStr(bs: any)[source]#
see ToBS()
SetParent(Parent: BaseClass)[source]#
set parent recursively
SimplySetParent(Parent: BaseClass)[source]#
set parent directly to this, not affecting members
MayBeParent() bool[source]#
CheckCompartabilityWith(TypeName: str, TypeSize: int) bool[source]#
ProcessInEditor(Parent: BaseClass) bool[source]#
RenderInScene(Parent: BaseClass) bool[source]#
HandleKey(code: int) bool[source]#
OnChangeMember(MembClass: BaseClass, MembPtr: any, MembExtra: any, MembName: str) bool[source]#
BeforeChangeMember(MembClass: BaseClass, MembPtr: any, MembExtra: any, MembName: str)[source]#
GetElementLevel(EName: str) int[source]#
OnCreateControlFromScratch(Context: any, Rect: any) any[source]#
OnModifyControl(FieldName: str, W: any, Context: any)[source]#
CanBeDragged(MemberID: str, dx: int, dy: int) bool[source]#
Use it for build a Drag & Drop element.
see CanAcceptDrag(), OnStartDrag(), OnEndDrag(), OnAcceptDrag()
CanAcceptDrag(MemberID: str) bool[source]#
OnStartDrag(MemberID: str) bool[source]#
OnEndDrag(MemberID: str) bool[source]#
OnAcceptDrag(DraggedItemParent: BaseClass, DraggedMemberID: str, AcceptorMemberID: str, MyRect: any) bool[source]#
UsePointerInHashCalculation() bool[source]#
SkipHash() bool[source]#
IsArray() bool[source]#
GetCmdID() str[source]#
SetParents()[source]#
SetParentsSafe()[source]#
set parents to this for all child members, each child will be tested for validity
static GetCurrentSaveFile() str[source]#
CurrentSaveFile: str = None#
If user triggers saving class to file, last filename stored there
UpdateClassMembersAndMask(recursive: bool)[source]#
SaveInShortForm: bool = False#
static UI_definition() bool[source]#
static Serialization() bool[source]#
class cSItem[source]#

Bases: object

Name: str#
Visible: bool#
getName() str[source]#
class cSBool(name: str, value: bool = False, visible: bool = True)[source]#

Bases: cSItem

static dynamic_cast(pObject: cSItem) cSBool[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cSBool class or its descendant, and if so, returns the specified object, but of the cSBool type.
Value: bool#
class cSColor(name: str, value: int = 0, visible: bool = True)[source]#

Bases: cSItem

static dynamic_cast(pObject: cSItem) cSColor[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cSColor class or its descendant, and if so, returns the specified object, but of the cSColor type.
Value: int#
class cSString(name: str, value: str, visible: bool = True)[source]#

Bases: cSItem

static dynamic_cast(pObject: cSItem) cSString[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cSString class or its descendant, and if so, returns the specified object, but of the cSString type.
Value: str#
class cSInt(name: str, value: int = 0, min: int = 0, max: int = 10, visible: bool = True)[source]#

Bases: cSItem

static dynamic_cast(pObject: cSItem) cSInt[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cSInt class or its descendant, and if so, returns the specified object, but of the cSInt type.
Min: int#
Max: int#
Default: int#
Value: int#
class cSFloat(name: str, value: float = 0, min: float = 0, max: float = 10, visible: bool = True)[source]#

Bases: cSItem

static dynamic_cast(pObject: cSItem) cSFloat[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cSFloat class or its descendant, and if so, returns the specified object, but of the cSFloat type.
Min: float#
Max: float#
Value: float#
Default: float#
class cREG[source]#

Bases: object

static modalMessageBox(text: str, Caption: str, Buttons: str, Flags: int, Class: BaseClass) int[source]#
static reg_class(class_ref: BaseClass)[source]#
static function_call(ui_cmd: str)[source]#
static checkbox(cb: cSBool)[source]#
static delimiter()[source]#
static droplist(field: cSInt, enum_id: str)[source]#
REG_DROPLIST(fieldID, name, EnumID) adds the droplist to UI, list into XML. The referred variable should be int
hideinitializer

Example:

::
class MyClass : public BaseClass{
int x1;
int x2;
SERIALIZE(){ …
//create enumerator just now and use immediately
REG_DROPLIST(x1, “droplist1”, “Item1|Item2|Item3”);
//Other option is to create Enumerator right there or somewhere in code
_MAKE_ONCE{//use it to avoid multiple call of code
Enumerator* E = ENUM.Get(“MYENUMERATOR”);
if(E->GetAmount() == 0){
E->Add(“SomeItem1”,Value1);
E->Add(“SomeItem1”,Value2); …
}
}
REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR”);
//You may define Enumerator just in one line
MAKE_ENUMERATOR(“MYENUMERATOR2”,”Item1|Item2|Item3”);
REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR2”); …
}
};
static make_enumerator(enum_id: str, content: str)[source]#
Make Enumerator in just one line
hideinitializer
|         MAKE_ENUMERATOR("MYENUMERATOR2","Item1|Item2|Item3");
….somewhere…
REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR2”);
Parameters:

content (str) – List of items “Item1,Item2,….”

static ui_layout(layout: str)[source]#
UI_LAYOUT(str) splits ui elements to several columns with proportional or fixed width
hideinitializer
UI_LAYOUT may use two additional keywords: TOP and BOTTOM. TOP moves controls to the tor of the window frame (header -like)
BOTTOM moves elements to the bottom of the frame, like toolset buttons. It is recommended to use ICON_BUTTON/3/4 for bottom toolset.

Example:

|          class MyClass : public BaseClass{
void button();
void long_button();
void X();
SERIALIZE(){ …
//places next 3 controls in one line: [button][long_button][X], length of [button] is twice less than [long_button], [X] has fixed width 32
UI_LAYOUT(“1 2 [32]”);
CLASS_METHOD_CALL(button);//[button]
CLASS_METHOD_CALL(long_button);//[long_button]
CLASS_METHOD_CALL(X);//[X] …
}
};
static slider_int(var: cSInt)[source]#
SLIDER(var,name,minvalue,maxvalue) to add integer/float slider in UI. Only float and int supported
hideinitializer

Example:

::
class MyClass : public BaseClass{ *
int x;
float y; *
SERIALIZE(){ …
SLIDER(x,”X”,0,10);
SLIDER(y,”Y”,0.0,10.0); …
}
};
Parameters:

var (cSInt) – variable ref

static slider_float(var: cSFloat)[source]#
static file_path(var: cSString, file_mask: str)[source]#
use FILEPATH(str, name, mask) to add file selection control in UI. Only cStr supported
hideinitializer

Example:

::
class MyClass : public BaseClass{
cStr path;
SERIALIZE(){
FILEPATH(path,”FilePath”,”save:.tif;.tiff;*.exr;*.tga;*.bmp;*.png”);
}
};
static vector2D(vec: cVec2)[source]#
register cVec2
static Rect(rect: any)[source]#
register Rct
static vector3D(vec: cVec3)[source]#
register Vector3D
static vector4D(vec: cVec4)[source]#
register Vector4D
static icon(path: str)[source]#
Insert icon if control supports.
static checkbox_group(group_name: str)[source]#
specify group for checkbox.
static hotkey(combo: str)[source]#
assign default hotkey to the UI element, like HOTKEY(“CTRL E”)
static left_align()[source]#
force left-align to the control
static element_color(color: str)[source]#
the element color
static font_color(color: str)[source]#
the font color
static reg_opt(opt: str)[source]#
static reg_coord(x: float, y: float, z: float)[source]#
Place 3 lines of code in correspondence with current coordinate system - Y-up or Z-up
hideinitializer
Parameters:
  • x (float) – X - related item

  • y (float) – Y - related item

  • z – Z - related item

class cAction[source]#

Bases: object

Enabled: bool#
Implementation: any#
cSlot Before;
ExecImplementation() bool[source]#
Run() bool[source]#
HasEnabledChild() bool[source]#
cAction* GetChild(int child_id);
class cExAction(name: str, extension: str, message: str, hint: str = '')[source]#

Bases: object

class LinkedObjectBaseType[source]#

Bases: object

static registerObjectType(objectType: LinkedObjectBaseType)[source]#
TopologyLocked: bool#
SetTopologyLocked(newValue: bool)[source]#
OnModifyTreeItem(Name: str, BW: any)[source]#
actions: list[cExAction]#
addAction(extension: str, name: str, message: str = '', hint: str = '')[source]#
clearActions()[source]#
objectType: str#
IconTexture: int#
extension for file
setIconTexture(textureID: int)[source]#
setObjectType(object_type: str)[source]#
class LinkedObject[source]#

Bases: BaseClass

static dynamic_cast(pObject: BaseClass) LinkedObject[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a LinkedObject class or its descendant, and if so, returns the specified object, but of the LinkedObject type.
getType() LinkedObjectBaseType[source]#
idx: int#
Scaling: float#
TopologyLocked: bool#
objectPath: any#
class cColorSelectorInterface[source]#

Bases: object

ShowAlpha: bool#
Red: float#
Green: float#
Blue: float#
Alpha: float#
ShowModal() bool[source]#
IsActive() bool[source]#
class pyRequirement[source]#

Bases: object

initialized: bool = True#
module_name: str#
module_version: str#
installing() bool[source]#
checkIfInstalled() bool[source]#
installing_name: str = ''#
installing_id: int = -1#
static install_all()[source]#
static Check(name: str, install: bool = True, show_progress: bool = False, ask: bool = False, on_finish: any = None) pyRequirement[source]#
static GetRequirementInfo(name: str) pyRequirement[source]#
static EnsurePipInstalled()[source]#
class cExtension[source]#

Bases: object

extensionHandler: any#
static Message(extension_name: str, message: str) bool[source]#
static ProcessID() int[source]#
static DebugPort() int[source]#
static getCoatInstallForder() str[source]#
refresh_menu() bool[source]#
add_menu_item(MenuPath: str, MenuItem: str, inRoom: str = '', inSection: str = '', Command: str = '') bool[source]#
onStop()[source]#
onStart()[source]#
onRestart()[source]#
menu_item(item_name: str, on_click: any) bool[source]#
getSourcePath() str[source]#
SourcePaoth
onMessage(message: str)[source]#
Call if another module sent message to this extension using cExtension.Message
onExtendMenu()[source]#
insert some menu items to main menu
onBuildMainMenu()[source]#
on build the main menu
onStartup()[source]#
Call on startup, right before tools initialisation.
afterInit()[source]#
Call it after tools, graphics and shaders initialisation.
preprocess()[source]#
Call it once per frame, before tools processing.
prerender()[source]#
Call it once per frame, before the rendering stage.
postprocess()[source]#
Call it once per frame, after tools processing.
postrender()[source]#
Call it once per frame, after the rendering stage.
afterUI()[source]#
Call it once per frame, after the ui rendering, before the topmost elements
thumbnail()[source]#
Call it once per frame to draw thumbnails.
afterSettings()[source]#
Call it once after settings loading.
onNew()[source]#
Call it as soon as user starts new scene.
onKey()[source]#
Call it as soon as user pressed the key, get the key value from Widgets::lastKey. Set it to 0 if the key captured and des not need to be propagated anymore.
onDropFile()[source]#
Call if file dropped using drag&drop, filename is in Widgets::LastDroppedFile. Set it empty if you acquired the file.
onChangeTool()[source]#
called when the current tool changes
onChangeRoom()[source]#
called when the current room changes
onUndo()[source]#
called when the undo triggered
onRedo()[source]#
called when the redo triggered
onSaveScene()[source]#
called before the saving the scene
onExit()[source]#
called before the exit
static begin_work_in_bg() int[source]#
static end_work_in_bg() int[source]#
class cExtensionHandler[source]#

Bases: BaseClass

static dynamic_cast(pObject: BaseClass) cExtensionHandler[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cExtensionHandler class or its descendant, and if so, returns the specified object, but of the cExtensionHandler type.
name: cStr#
uiname: cStr#
path: cStr#
mainModule: any#
onStartUpModule: any#
Loaded: bool#
NeedRestartApp: bool#
extension: cExtension#
Started: bool#
Active: bool#
AutoStart: bool#
StartAfterInstalls: bool#
Error: bool#
ErrorMessage: cStr#
dependencies: any#
Start()[source]#
Stop()[source]#
Restart()[source]#
OnState(state: cStr)[source]#
class ExtensionManager[source]#

Bases: BaseClass

static dynamic_cast(pObject: BaseClass) ExtensionManager[source]#
An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a ExtensionManager class or its descendant, and if so, returns the specified object, but of the ExtensionManager type.
ProcessID: int = 31560#
DebugPort: int = 6449#
static AutoReloadModules() bool[source]#
static OnExtensionState(state: cStr)[source]#
static SetExtensionManager(extensionManager: ExtensionManager)[source]#
MainColorSelector: cColorSelectorInterface = <cModules.QTColorSelector.QTColorSelector.QTColorSelector object>#
NeedRefreshPyInstalledModuleList: bool = False#
AddInstalledPyModule(module_name: str)[source]#
ClearInstalledPyModuleList()[source]#
static CommandToPy(command: str) str[source]#
Command(command: str) bool[source]#
static ExecScriptFromCPPStatic(script: str) bool[source]#
ExecScript(script: str) bool[source]#
ExecByIdx(action_idx: int) bool[source]#
Expression(source: str) str[source]#
OnImport(module: str)[source]#
ImportModule(module: str) bool[source]#
Run(file_path: str)[source]#
RunPy(file_path: str) bool[source]#
static RunPyFromCPPStatic(file_path: str) bool[source]#
LoadExtensions(rootFolderPath: cStr)[source]#
Refresh()[source]#
OnProcess()[source]#
RefreshInstalledList()[source]#
static currentDateTime() str[source]#
static Init()[source]#
ReloadChangedModules()[source]#
static SetupVSCodeProject(aProjectFolder: cStr, aModulesInit: bool, aLibRoot: bool)[source]#
static StringFromFile(aFileName: cStr) cStr[source]#
static StringToFile(aSource: cStr, aFileName: cStr)[source]#
FindExtension(extName: cStr) cExtensionHandler[source]#
class ExtPhotogrammetryEngine[source]#

Bases: object

Registred: bool#
hasHowToInstall: bool#
hasAutoInstall: bool#
hasSetPathToEngine: bool#
engineName() str[source]#
Register(setDefault: bool = False) bool[source]#
NeedAutoReconstruction() bool[source]#
ShotsTo3D()[source]#
ImportProject()[source]#
BakeUVTextures()[source]#
VideoTo3D()[source]#
HowToInstall()[source]#
AutoInstall()[source]#
SetPathToEngine()[source]#
CheckIfInstalled() bool[source]#